<?php
/*
YHM (Your Hosting Manager) - Copyright 2010 All Rights Reserved. - YHM Group
Released under the Simplified BSD Licence.

Website: http://yhm.co.uk
Licence: http://yhm.co.uk/about/#licence

file: order/index.php
author: Kieran D. (Polarbear541)
*/

//Init Includes, Sessions and Page Info
require_once("../global.php");
session_start();
$username = $_SESSION['user_name'];
$page = "order";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>YHM - Order</title>
<meta http-equiv="Content-Language" content="English" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="../style.css" media="screen" />
<script type="text/javascript">
function showDomain() {
  document.getElementById("Domain").style.visibility = "visible";
  document.getElementById("Domain").style.display = "";
}

function hideDomain() {
  document.getElementById("Domain").style.display = "none";
}

function showSubdomain() {
  document.getElementById("Subdomain").style.visibility = "visible";
  document.getElementById("Subdomain").style.display = "";
}

function hideSubdomain() {
  document.getElementById("Subdomain").style.display = "none";
}
</script>
</head>
<body>

<?php include("./header.php"); ?>

<div id="content">

<?php
$action = $_REQUEST['action'];

switch($action)
{
case "step1":
	echo "<h2>Order Package - Step 2/3</h2>";
	createclient();
break;

case "step2":
	echo "<h2>Order Package - Step 3/3</h2>";
	confirm();
break;

default:
	echo "<h2>Order Package - Step 1/3</h2>";
	intro();
break;
}

function intro()
{
	if ($_SESSION['loggedin'] == true)
	{
		$nextpage = "step2";
	}
	else
	{
		$nextpage = "step1";
	}
	
	$getpkgs = mysql_query("SELECT * from ".TABLE_PREFIX."packages WHERE status = '1'");
	
	echo "<form method='POST' action='./index.php'>";
	
	echo "Domain Type:<br />
	<input type='radio' name='domtype' value='domain' onclick='showDomain(); hideSubdomain();' checked /> Domain
	<input type='radio' name='domtype' value='subdomain' onclick='hideDomain(); showSubdomain();' /> Subdomain";
	
	echo "<span id='Domain'>Domain (yourdomain.ext): <input type='text' name='domain' /></span>";
	echo "<span style='display: none' id='Subdomain'>Subdomain: <input type='text' name='sub1' /><select name='sub2'><option>test</option></select></span><br />";
	
	while ($pkgs = mysql_fetch_array($getpkgs))
	{
		echo $pkgs['name'] . "<br />";
		echo $pkgs['desc'] . "<br />";
	}
	
	//Next Button
	echo "<br />Click 'Next' to choose your domain type.</p>
	<input type='hidden' name='action' value='$nextpage' />
	<input type='submit' value='Next' />
	</form>";
}

function createclient()
{
	if ($_SESSION['loggedin'] == true)
	{
		redirect("./index.php?action=step3");
	}
	
	$nextpage = "step3";
}

function confirm()
{
	
}
?>

<?php include("../footer.php"); ?>
</div>
</body>
</html>